from relax import *
from tryy import *
from cycles import *
from cost_matrix import *
from graph import *

import networkx as nx

B = lecture("villes.txt") #coordonnees des points
M = fill_distance_matrix(B) #matrice des couts entre deux villes i et j
L = enumerer_cycles(len(B)) #liste des cycles
C = recherche_cout(L, M) #L liste des cycles, M matrice des couts

Sol = []
V = []
for s in range(len(B)):
    if not s in V:
	c = cycle_minimum(s, L, C)
	Sol.append(c)
	for sommet in c[0]:
	    if not sommet in V:
		V.append(sommet)
	relaxation(L, C, M, c[0])

print Sol

G = dessin_graph(Sol, B)
nx.draw(G)
nx.write_dot(G, "graph.dot")
plt.show()
